SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS OFF
GO

CREATE PROCEDURE  [dbo].[paObtenerVistaCombo]

@Vista VARCHAR(50),
@Existe INT OUTPUT 

AS
SET NOCOUNT ON
SELECT   @Existe=COUNT(Vista) FROM tb_VistasCombos WHERE Vista = @Vista

if @Existe=1 and exists (select top 1 vista FROM tb_VistasCombos WHERE Vista = @Vista and Campo is null)
   set @Existe=99
GO
GRANT EXECUTE ON  [dbo].[paObtenerVistaCombo] TO [public]
GO
